import {observable,action} from 'mobx';
import em from '../utils/eventemitter';
import emKeys from '../conf/eventemitterKeys';

class Model {
    @observable userInfo = {};
    @action setUserInfo = (data) => {
        this.userInfo = data;
    }
    @observable currentMenus = ['fileText'];
    @action setCurrentMenus = (data) => {
        this.currentMenus = data;
    }

    @observable title = '';
    @action setTitle = (data) => {
        this.title = data;
    }

    
}

const model = new Model();
em.on(emKeys.changeRoute,(key)=>{
    model.setCurrentMenus([key]);
});
em.on(emKeys.changeTitle,(title)=>{
    model.setTitle(title);
});
export default model;